<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<!DOCTYPE html>
	<html lang="en" class="no-ie" style="overflow:hidden;">
		<head>
			<meta charset="UTF-8">
			<title>近7天进场分析</title>
			<script>
				"object" != typeof ue || "object" != typeof ue.interface ? ("object" != typeof ue && (ue = {}), ue.interface = {},
					ue.interface.broadcast = function(e, t) {
						if ("string" == typeof e) {
							var o = [e, ""];
							void 0 !== t && (o[1] = t);
							var n = encodeURIComponent(JSON.stringify(o));
							"object" == typeof history && "function" == typeof history.pushState ? (history.pushState({}, "",
								"#" + n), history.pushState({}, "", "#" + encodeURIComponent("[]"))) : (document.location
								.hash = n, document.location.hash = encodeURIComponent("[]"))
						}
					}) : function(e) {
					ue.interface = {}, ue.interface.broadcast = function(t, o) {
						"string" == typeof t && (void 0 !== o ? e.broadcast(t, JSON.stringify(o)) : e.broadcast(t, ""))
					}
				}(ue.interface), (ue4 = ue.interface.broadcast);
			</script>
			<script src="./dist/echarts.min.js"></script>
			<script src="./static/js/jquery.min.js"></script>
			<script src="./static/js/FuncTest.js"></script>
			<script src="./static/js/PortChart.js"></script>
			<script>
				$(function() {
					ue4("getSize", {
						mes: "get windows size"
					});
					ue4("getColor", {
						mes: "get all color"
					});
					ue4("getData", {
						mes: "get all data"
					});
					ue4("beginSize", {
						mes: BeginSize[0],
						mes2: BeginSize[1]
					});
					ue4("beginSizeY", {
						mes: BeginSize
					});
				});
				/*$(function () {
				    
				});*/
			</script>
			<style>
				* {
					margin: 0;
					padding: 0;
				}
			</style>
		</head>
		<body>
			<div id="main"></div>
			<!--
		dataTemp1: y轴数值;dataTemp2: x轴标题
		-->
			<script>
				let BeginSize = [418.48, 227.06];
				let myChart = null;
				let myColor = ['#58E5B0', '#9B6AE2', '#E5BC8D', '#17A4FA'];
				let dataList = [59, 32, 19, 82,10];
				let dataList1 = [12.509, 10.7, -10.35, 19.182,10];
				let dataTitle = ['2018', '2019', '2020', '2021','2022'];

				function fresh() {
					if (myChart == null) {
						myChart = echarts.init(document.getElementById('main')); //利用原型调取Echarts的初始化方法
					}
					let minNum=Math.min.apply(null, dataList1);
					let data1 = [];
					let data2 = [];
					
					dataList1.forEach((item,index) => {
						if (index>=dataList1.length-1) {
							data2.push([dataTitle[index], item]);
						} else {
							data1.push([dataTitle[index], item]);
						}
					});
					data2.unshift(data1[data1.length - 1]);
					let option = {
						backgroundColor: 'rgba(3, 16, 38, 0.71)',
						title:[{
						    text: "融资事件数(起)",
						    left: "5%",
						    top: "2%",
						    textStyle: {
						      fontSize: 15,
						      color: "#99c8ff",
						      fontFamily: 'SourceHanSansCN'
						    }
						  },{
						    text: "增速(%)",
						    right: "3%",
						    top: "2%",
						    textStyle: {
						      fontSize: 15,
						      color: "#99c8ff",
						      fontFamily: 'SourceHanSansCN'
						    }
						  }],
						tooltip: {
							trigger: 'axis',
							backgroundColor: "#031026",
							borderColor: "#031026",
							axisPointer: {
							    type: 'none',
							},
							formatter: function(params){
								// console.log(params[1])
								var str = `${params[0].name}<br /><span style=font-size:13px>融资事件数</span> <span style=color:#00D8FF;font-size:12;>${params[0] ? params[0].data : ''}</span>
								<br /><span style=font-size:13px>融资事件增速</span> <span style=color:#00D8FF;font-size:12;>${params[1].data[1]? params[1].data[1] : ''}%</span>`
								return str
								
							},
							textStyle: {
							      color: "#FFFFFF",
								  fontSize:14
							},
						},
						legend: {
							show: false,
						},
						grid: {
							left: '4%',
							right: '0%',
							top: '20%',
							width: "92%",
							height: '75%',
							containLabel: true
						},
						xAxis: [{
							splitLine: {
								show: false
							},
							axisLine: {
								show: true,
								lineStyle: {
									type: 'solid',
									color: '#B1B1B1',
									width: 1
								}
							},
							axisTick: {
								show: false,
							},
							axisLabel: {
								color: '#DFF8FF',
								fontSize: 17,
								interval: 0,
							},
							data: dataTitle,
							type: 'category',
							show: true,
						}],
						yAxis: [{
								id: 0,
								splitLine: {
									show: true,
									lineStyle: {
										type: 'dotted',
										color: '#556468',
										width: 1
									}
								},
								axisLine: { //y轴
									show: true,
									lineStyle: {
										type: 'solid',
										color: '#B1B1B1',
										width: 1
									}
								},
								type: 'value',
								axisTick: {
									show: false
								},
								axisLabel: {
									color: 'rgba(255,255,255,0.6)',
									fontSize: 15,
									margin: 10,
									formatter: function(params){
										return params.toFixed(0)
									}
								},
								splitNumber: 3,
								// interval: Math.ceil(Math.max.apply(null, dataList) / 5), //Math.max.apply取出数组最大值
								// max: Math.ceil(Math.max.apply(null, dataList) / 5) * 5, //Math.ceil向上取整
								// min: 0,
							},
							{
								id: 1,
								axisLine: {
									show: true,
									lineStyle: {
										type: 'solid',
										color: '#B1B1B1',
										width: 1
									}
								},
								splitLine: {
									show: false
								},
								type: 'value',
								axisTick: {
									show: false,
								},
								axisLabel: {
									color: 'rgba(255,255,255,0.6)',
									fontSize: 15,
									interval: 0.2,
									formatter: function(params){
										return params.toFixed(0)+'%'
									}
								},
								splitNumber: 2,
								// interval: Math.ceil(Math.max.apply(null, dataList1) / 5), //Math.max.apply取出数组最大值
								// max: Math.ceil(Math.max.apply(null, dataList1) / 5) * 5, //Math.ceil向上取整
								// min: minNum,
							}
						],
						series: [{
								type: 'bar',
								name: '融资事件数',
								barWidth: 12,
								data: dataList,

								yAxisIndex: 0,
								itemStyle: {
									normal: {
										color: new echarts.graphic.LinearGradient(0, 0, 0, 1,
											[{
												offset: 0,
												color: 'rgba(4, 205, 244, 1)' // 0% 处的颜色
											}, {
												offset: 1,
												color: 'rgba(38, 130, 255, 1)' // 100% 处的颜色
											}]),
										barBorderRadius: 5,
									}
								}
							},
							{
								type: 'line',
								data: data1,
								yAxisIndex: 1,
								smooth: false, //平滑曲线显示
								symbol: "circle", //标记的图形为实心圆
								symbolSize: 8, //标记的大小
								itemStyle: {
									normal: {
										color: 'rgba(3, 7, 14, 1)',
										borderColor: 'rgba(245, 186, 37, 1)', //圆点透明 边框
										borderWidth: 2
									},

								},
								lineStyle: {
									color: "rgba(245, 186, 37, 1)",
									type: "solid"
								},
							},
							{
								type: 'line',
								data: data2,
								yAxisIndex: 1,
								smooth: false, //平滑曲线显示
								symbol: "circle", //标记的图形为实心圆
								symbolSize: 8, //标记的大小
								itemStyle: {
									normal: {
										color: 'rgba(3, 7, 14, 1)',
										borderColor: 'rgba(245, 186, 37, 1)', //圆点透明 边框
										borderWidth: 2
									},
							
								},
								lineStyle: {
									color: "rgba(245, 186, 37, 1)",
									type: "dashed"
								},
							}
						]
					};
					myChart.setOption(option);
				}
				fresh();


				//浏览器测试用
				change(BeginSize[0], BeginSize[1]);

				function change(x, y) {
					let div = document.getElementById("main");
					//alert("I am an alert box!!");
					div.style.width = x + "px";
					div.style.height = y + "px";
					var myOption = myChart.getOption();
					// console.log(myOption.series[0].type)
					myChart.resize();
					// return myOption.series[0].type
					let types = []
					myOption.series.forEach((item) => {
						types.push(item.type)
					})
					return types

				}


				/************下面数据***********/
				// ue.interface.TransList = function(data) {
				// 	dataList = data;
				// 	fresh();
				// };
				// ue.interface.TransList1 = function(data) {
				// 	dataList1 = data;
				// 	fresh();
				// };
				//
				// ue.interface.TransList2 = function(data) {
				// 	itemTitle = data;
				// 	fresh();
				// };
				ue.interface.TransList = function(data) {
					var obj = JSON.parse(data);

					dataList = obj.data1;
					dataList1 = obj.data2;
					dataTitle = obj.data3;

					fresh();
				}
			</script>
		</body>
	</html>

	<body>
	</body>
</html>
